package com.example.tests;


import java.util.Collections;
import java.util.List;
import static org.testng.Assert.assertEquals;
import org.testng.annotations.Test;


public class ContactCreationTests extends TestBase{
 
  @Test
  public void testNonEmptyContactCreation() throws Exception {
    app.getNavigationHelper().openMainPage();
    
    //save old state
    List<ContactData> oldlist = app.getContactHelper().getContacts();
    // action
    app.getContactHelper().initContactCreation();
    ContactData contact = new ContactData();
    contact.firstname = "sdfasfawfrewarfw";
    contact.lastname = "lastname";
    contact.adress = "adress";
    contact.home = "home";
    contact.mobile = "mobile";
    contact.work = "work";
    contact.email = "email";
    contact.email2 = "email2";
    contact.bday = "1";
    contact.bmonth = "September";
    contact.byear = "1988";
    app.getContactHelper().fillContactCreation(contact);
    app.getContactHelper().submitContactCreation();
    app.getContactHelper().returnToContactPage();
    
    // save new state
    List<ContactData> newlist = app.getContactHelper().getContacts();
    
    //compare states
    
    assertEquals(newlist.size(), oldlist.size()+1);
    oldlist.add(contact);
    assertEquals(newlist, oldlist);
  }
  
  
  
  //@Test
  public void testEmptyContactCreation() throws Exception {
    app.getNavigationHelper().openMainPage();
    ContactData contact = new ContactData("","","","","","","","","0","-","","[none]");
    app.getContactHelper().initContactCreation();
    app.getContactHelper().fillContactCreation(contact);
    app.getContactHelper().submitContactCreation();
    app.getContactHelper().returnToContactPage();
    app.getNavigationHelper().goToHomePage();
    
   
  }
  
 
	   
	   
  
 }

